package com.diandian.backend.order.param;

import com.diandian.base.boot.starter.exception.DefaultException;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

public class OrderOnlineDouyinLifeAddParam implements Serializable {

	private List<OrderOnlineDouyinLifeAddParamData> orderList;
	private String belong;
	private Boolean replaceFlag;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date startTime; // 订单创建开始时间，会先清理掉这部分订单
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date endTime; // 订单创建截止时间，会先清理掉这部分订单

	public void check(){
		if(this.orderList == null || this.orderList.size() == 0 || this.orderList.size() > 50){
			throw new DefaultException("数据集合不合法");
		}
		if(this.belong == null || "".equals(this.belong)){
			throw new DefaultException("归属不能为空");
		}
		if(this.replaceFlag != null){
			if(this.startTime == null){
				throw new DefaultException("开始时间不能为空");
			}
			if(this.endTime == null){
				throw new DefaultException("截止时间不能为空");
			}
		}
	}

	public List<OrderOnlineDouyinLifeAddParamData> getOrderList() {
		return orderList;
	}

	public void setOrderList(List<OrderOnlineDouyinLifeAddParamData> orderList) {
		this.orderList = orderList;
	}

	public String getBelong() {
		return belong;
	}

	public void setBelong(String belong) {
		this.belong = belong;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Boolean getReplaceFlag() {
		return replaceFlag;
	}

	public void setReplaceFlag(Boolean replaceFlag) {
		this.replaceFlag = replaceFlag;
	}
}
